﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace ProcessKiller
{
    class killProcess
    {
        public static void stopNamedProcess(string name)
        {
            foreach (Process p in System.Diagnostics.Process.GetProcessesByName(name))
            {
                try
                {
                    p.Kill();
                    p.WaitForExit();
                }
                catch (Exception KillException)
                {
                    Console.WriteLine(KillException.Message);
                    System.Diagnostics.EventLog.WriteEntry("ProcessKiller ", KillException.Message, System.Diagnostics.EventLogEntryType.Error);
                }

            }

        }
    }

}
